﻿using JavaCodeGeneratorConsole.utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace JavaCodeGeneratorConsole.entity
{
    public class TableInfo
    {
        public int idx { get; set; }
        public string name{ get; set; }
        public string camelName { get; set; }
        
        public string packageName { get; set; }
        public string entityPackageName { get; set; }
        public string mapperPackageName { get; set; }
        public string servicePackageName { get; set; }
        public string serviceImplPackageName { get; set; }
        public string controllerPackageName { get; set; }

        public string entityName{ get; set; }
        public string mapperName{ get; set; }
        public string serviceName{ get; set; }
        public string serviceImplName{ get; set; }
        public string controllerName{ get; set; }
        public List<TableColunm> tableDatas { get; set; }

        public void Update()
        {
            entityName = StringUtils.SnakeRenameCase(name);
            camelName = StringUtils.RenameCamelCase(entityName);
            mapperName = entityName + "Mapper";
            serviceName = entityName + "Service";
            serviceImplName = entityName + "ServiceImpl";
            controllerName = entityName + "Controller";

            entityPackageName = $"{packageName}.entity";
            mapperPackageName = $"{packageName}.mapper";
            servicePackageName = $"{packageName}.service";
            serviceImplPackageName = $"{packageName}.service.impl";
            controllerPackageName = $"{packageName}.controller";
        }
    }
}
